Skip to main content

revXMLSetAttribute

Type

command

Summary

Creates an attribute of a node, or sets the value of an existing attribute.

Syntax

revXMLSetAttribute <treeID>, <node>, <attributeName>, <newValue>

Description

Use the revXMLSetAttribute command to create and change attributes.

If the attributeName is not already an attribute of the node, a new attribute with the specified name and value is created.

If the attribute already exists, its value is set to the newValue.

tip

To put Unicode text into an attribute, first use the uniDecode function to encode the text as UTF-8:

    revXMLSetAttribute myTree,the nodeName of me, \
uniDecode(the unicodeText of it,\"UTF8\")
Important

The revXMLSetAttribute command is part of the XML library. To ensure that the command works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "XML" checkbox is checked.

Parameters

NameTypeDescription

treeID

The number returned by the revXMLCreateTree or revXMLCreateTreeFromFile function when you created the XML tree.

node

The path to the node whose attribute will be set.

attributeName

string

newValue

string

Examples

revXMLSetAttribute 6,"/Vegetable/Tree/Cedar","height","tall"
revXMLSetAttribute thisTree,currNode,myString,field "Data"

command: revXMLAppend

function: revXMLAttributes, result, uniDecode

glossary: Unicode, node, Standalone Application Settings, standalone application, attribute, command, LiveCode custom library

library: XML library

Compatibility and Support

Introduced

LiveCode 2.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?